<template>
  <a-modal
    :title="title"
    :visible="openDialog"
    :maskClosable="false"
    :destroyOnClose="true"
    :footer="null"
    @cancel="mainDialogClose()"
  >
    <!-- @cancel="mainDialogClose('commonForm')" -->
    <a-table
      :columns="columns"
      :data-source="lists"
      :pagination="false"
      :rowKey="
        (record, index) => {
          return index;
        }
      "
    ></a-table>
  </a-modal>
</template>

<script>
import api from "@/server/userConfig";

const columns = [
  {
    title: "零件类型",
    align: "center",
    dataIndex: "kitType"
  },
  {
    title: "零配件型号",
    align: "center",
    dataIndex: "kitVersion"
  },
  {
    title: "发货数量",
    align: "center",
    dataIndex: "number"
  }
];

export default {
  name: "detailPartDialog",
  props: {
    openDialog: Boolean,
    title: String,
    info: Object
  },
  components: {},
  data() {
    return {
      // username: '',
      // role: '',
      // compId: '',
      // compType: '',
      columns: columns,
      lists: [],
      commonForm: {}
    };
  },
  watch: {
    openDialog: {
      immediate: false,
      handler: async function(newVal, oldVal) {
        let { kitInformationList } = this.info;
        this.lists = [...kitInformationList];
      }
    }
  },
  methods: {
    mainDialogClose(formName) {
      // this.$refs[formName].resetFields();
      this.$emit("update:openDialog", false);
      // this.$emit("closeDialogRefreshData");
    }
  },
  mounted() {},
  created() {}
};
</script>

<style scoped></style>
